<template>
  <div class="playing">
    <div class="list">
        <movie-list v-for="item of subjects" :key="item.id" :item="item"></movie-list>
    </div>
  </div>
</template>

<script>
// @ is an alias to /src
import MovieList from '../components/MovieList.vue'
export default {
  name: 'playing',
  components: {
    MovieList
  },
  data(){
    return {
      subjects:[]
    }
  },
  async mounted(){
      if(localStorage.getItem('theaters')){
        this.subjects = JSON.parse(localStorage.getItem('theaters'));
      }else{
          let res = await this.axios.get("/movie/in_theaters");
          console.log(res);
          let str = JSON.stringify(res.data.subjects);
          localStorage.setItem("theaters",str);
          this.subjects = res.data.subjects;
      }
  }
}
</script>
<style scoped>

</style>
